import axios from 'axios'

let _axios = axios.create({
  baseURL: process.env.VUE_APP_BASE_API,
  headers: {
    'Accept': 'application/vnd.gvrbox.v1+json'
    // 'Access-Control-Allow-Origin': '*'
  }
})
// Add a response interceptor
_axios.interceptors.response.use(
  function (response) {
    // Do something with response data
    if (response.data.status_code === 200) {
      return response.data.data
    } else {
      return response
    }
  },
  function (error) {
    // Do something with response error
    return Promise.reject(error)
  }
)
export default async function () {
  return _axios.post('/oauth/token', {
    client_id: 2,
    client_secret: 'Gk3HZ8Fu9BveE4KrYf6LwiDJcfQ0AXZkMmX78klV',
    grant_type: 'client_credentials'
  })
}
